package com.smartleanx.module.hrm.dal.mysql.payrollapproverecord;

import com.smartleanx.framework.common.pojo.PageResult;
import com.smartleanx.framework.mybatis.core.mapper.BaseMapperX;
import com.smartleanx.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.smartleanx.module.hrm.controller.admin.payrollapproverecord.vo.PayrollApproveRecordDetailPageReqVO;
import com.smartleanx.module.hrm.dal.dataobject.payrollapproverecord.PayrollApproveRecordDetailDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 薪资审批记录详情 Mapper
 *
 * @author zhangchp
 */
@Mapper
public interface PayrollApproveRecordDetailMapper extends BaseMapperX<PayrollApproveRecordDetailDO> {

    default PageResult<PayrollApproveRecordDetailDO> selectPage(PayrollApproveRecordDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PayrollApproveRecordDetailDO>()
                .eq(PayrollApproveRecordDetailDO::getPayrollApproveRecordId, reqVO.getPayrollApproveRecordId())
                .orderByDesc(PayrollApproveRecordDetailDO::getId));
    }

    default List<PayrollApproveRecordDetailDO> selectByPayrollApproveRecordId(Long payrollApproveRecordId){
        return selectList(new LambdaQueryWrapperX<PayrollApproveRecordDetailDO>()
                .eq(PayrollApproveRecordDetailDO::getPayrollApproveRecordId, payrollApproveRecordId));
    }
}